using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using UnityEngine.SceneManagement;

public class LevelManager:MonoBehaviour
{
    public static LevelManager Instance;
    public int currentLevel=1;
    AudioSource audioSource;
    public bool Restart = false;
    private void Awake()
    {
        DontDestroyOnLoad(transform.parent);
        audioSource = GetComponent<AudioSource>();
        if(Instance == null)
            Instance = this;
    }
    
    public void RestartLevel()
    {
       Restart = true;
        audioSource.Play();        
        SceneManager.LoadScene(currentLevel);
    }

    IEnumerator RestartRoutine()
    {
        yield return new WaitForSeconds(1f);
        Restart = false;
    }
}
